﻿using ET;
using FairyGUI;
using UnityEngine;
namespace Core
{
    public class ResourceComponent : Entity
    {
        public T Load<T>(string path)where T : UnityEngine. Object
        {
            return Resources.Load<T>(path);
        }

        public async ETTask<T> LoadAsync<T>(string path) where T : UnityEngine.Object
        {
            return Resources.Load<T>(path);
        }

        public AssetBundle LoadAssetBundle(string path)
        {
            return default;
        }

        public async ETTask<AssetBundle> LoadAssetBundleAsync(string path, bool isUIPackage = false)
        {
            if (isUIPackage)
            {
                var package = UIPackage.AddPackage($"FGUI/{path}");
                if (package == null)
                {
                    Log.Error($"load package {path} fail!");
                    return default;
                }
            }
            return default;
        }
    }

}